package org.lexicon.swpogo;

import static org.junit.Assert.*;
import com.hp.hpl.jena.rdf.model.Resource
import com.hp.hpl.jena.rdf.model.Property
import org.junit.Before;
import org.junit.Test;

class DefaultSemWebPogoTest {
	
	private TestSemWebPogo pogo 
	private Resource pogoResource
	
	@Before
	public void setUp() {
		this.pogo = new DefaultSemWebPogo("uuid:test") 
	}
	
	@Test
	public void testStaticPrefixMappings() {
		this.pogo.getPrefixMapping().getNsPrefixMap().each {
			assert SemWebPogo.rdfPrefixMappings.containsKey(it.key) && SemWebPogo.rdfPrefixMappings.get(it.key).equals(it.value)
		}
	}
	
	@Test
	public void testAddingAndRemovingAPrefix() {
		this.pogo.addPrefix("http://purl.org/dc/terms", "dcterms")
		assert (this.pogo.getPrefixMapping().getNsPrefixMap().containsKey("dcterms") && this.pogo.getPrefixMapping().getNsPrefixMap().containsValue("http://purl.org/dc/terms"))
		this.pogo.removePrefix()
		assert (!this.pogo.getPrefixMapping().getNsPrefixMap().containsKey("dcterms"))
	}
	
	@Test
	public void testBasicLiteralPropertyMapping() {
		this.pogo.testLiteralField = "test literal 123"
		assert this.pogo.model.containsLiteral(this.pogo.model.createResource(this.pogo.uri.toString()), this.pogo.createProperty(this.pogo.class.rdfPropertyMappings.getAt("testLiteralField")), pogo)
	}
	
	public void testBasicClassMapping() {
		
	}
	
}
